<?php
namespace app\home\controller;

use think\Db;
use think\Controller;
use think\Request;
use think\Session;
use think\Cookie;

class Login extends Controller{

	public function login(){
		if(Request::instance()->isPost()){
			$request = Request::instance();
			$u_name = $request->post('u_name');
			$u_pwd = $request->post('u_pwd');

			$res = Db::name('user_rbac')->where("u_name = '$u_name' and u_pwd = '$u_pwd'")->find();
			if($res){
	    		session("u_id",$res['u_id']);
	    		echo 1;
	    	}else{
	    		echo 2;
	    	}
		} else {
			return view('login');
		}
	}
}